package com.lagou.module01.service;

import com.lagou.module01.dao.StudentDao;
import com.lagou.module01.entity.PageBean;
import com.lagou.module01.entity.Student;
import com.lagou.module01.factory.StudentDaoFactory;

import java.util.List;

public class StudentService {
    private StudentDao studentDao;
    public StudentService(){
        studentDao = StudentDaoFactory.getStudentDao();
    }

    //显示所有学生信息
    public List<Student> studentShow(PageBean pageBean){
        return studentDao.studentShow(pageBean);
    }

    //查询数据表的总条数
    public int selectSumPage(){
        return studentDao.selectSumPage();
    }

    //增加学生信息
    public int StudentAdd(Student student){
        return studentDao.studentAdd(student);
    }

    //通过学号删除学生信息
    public int StudentRemove(int id){
        return studentDao.studentRemove(id);
    }

    //修改学生信息
    public int StudentUpdate(Student student){
        return studentDao.studentUpdate(student);
    }

    //通过学号查询学生信息
    public Student getStudentById(int id){
        return studentDao.getStudentById(id);
    }
}
